import axios from 'axios';
import config from "@/util/config.js";

const API_URL = config.mdUrl+'/md/vs';

const vsAPI = {
    // 添加部门信息
    addResource(param, callback) {
        axios.request({
            url: `${API_URL}/add`,
            method: 'post',
            headers: {
                "Content-Type": "application/json;charset=UTF-8"
            },
            data: JSON.stringify(param)
        }).then((res) => {
            callback(res.data);
        })
    },
    //修改工装夹具信息
    updateResource(param, callback) {
        axios.request({
            url: `${API_URL}/update`,
            method: 'put',
            headers: {
                "Content-Type": "application/json;charset=UTF-8"
            },
            data: JSON.stringify(param)
        }).then((res) => {
            callback(res.data);
        })
    },
    //删除工装夹具信息
    deleteResource(param, callback) {
        axios.request({
            url: `${API_URL}/delete`,
            method: 'delete',
            headers: {
                "Content-Type": "application/json;charset=UTF-8"
            },
            data: JSON.stringify(param)
        }).then((res) => {
            callback(res.data);
        })
    },
    //根据工作站ID查询工装夹具信息
    getResourcesWorkId(param, callback) {
        axios.request({
            url: `${API_URL}/work`,
            method: 'get',
            params: param
        }).then((res) => {
            callback(res.data);
        })
    },
    //根据工装夹具名称查询
    getResourceByName(param, callback) {
        axios.request({
            url: `${API_URL}`,
            method: 'get',
            params: param
        }).then((res) => {
            callback(res.data);
        })
    },
};
export default vsAPI;